﻿<%@ Page Language="C#" AutoEventWireup="true" Codebehind="buyapplist.aspx.cs" Inherits="LabMS.Web.Equipment.common.buyapplist" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<script src="../../js/calendar5.js" type="text/javascript"></script>

<head runat="server">
    <title>购买申请列表</title>
    <link type="text/css" rel="stylesheet" href="../../style/screen.css" />
    <!--[if lte IE 6]>
    <link type="text/css" rel="stylesheet" href="../../style/ie6.css" />
    <![endif]-->
    <!--[if lte IE 7]>
    <link type="text/css" rel="stylesheet" href="../../style/ie7.css" />
    <![endif]-->

    <script language="JavaScript" type="text/javascript">
    var c = new Calendar("c");
        document.write(c);
    </script>

</head>
<body class="mainBody">
    <form id="form1" runat="server">
        <div class="main">
            <div id="pageInfo" class="clearfix">
                <div class="title">
                    <label>
                        购买申请列表</label>
                </div>
            </div>
        </div>
        <div class="main">
            <p>
                <% if (UserType == "teacher")
                   {%>
                <input id="btAddBuyApp" type="button" onclick="RedirectURL(window, 'buyapp.aspx');"
                    value="添加购买申请" class="button" />
                <%} %>
                <asp:Button ID="DeleteBtn" CssClass="button" runat="server" Text="删除" OnClick="Delete_OnClick" />
            </p>
            <p>
                <% if (UserType == "mana")
                   {%>
                <label class="itemTitle">
                    申 请 人：</label><asp:TextBox ID="AppPersonTBX" runat="server"></asp:TextBox>
                <%} %>
                <label class="itemTitle">
                    申请时间：</label><asp:TextBox ID="StartDateTBX" runat="server"></asp:TextBox>—<asp:TextBox
                        ID="EndDateTBX" runat="server"></asp:TextBox>
                <% if (UserType == "mana")
                   {%>
            </p>
            <p>
                <%} %>
                <label class="itemTitle">
                    申请备注：</label><asp:TextBox ID="AppComment" runat="server"></asp:TextBox>
                <% if (UserType == "teacher")
                   {%>
            </p>
            <p>
                <%} %>
                <label class="itemTitle">
                    审核备注：</label><asp:TextBox ID="VerifyComment" runat="server"></asp:TextBox>
                <label class="itemTitle">
                    类型：</label><asp:DropDownList ID="TypeDDL" runat="server">
                        <asp:ListItem Text="--所有类型--" Value="0"></asp:ListItem>
                        <asp:ListItem Text="消耗品" Value="xiaohaopin"></asp:ListItem>
                        <asp:ListItem Text="低值品" Value="lowvalue"></asp:ListItem>
                        <asp:ListItem Text="仪器" Value="yiqi"></asp:ListItem>
                        <asp:ListItem Text="贵重仪器" Value="guizhongyiqi"></asp:ListItem>
                    </asp:DropDownList>
                <asp:Button ID="SearchBtn" CssClass="button" runat="server" Text="搜索" OnClick="Search_OnClick" />
                <input id="reset" class="button" runat="server" value="重置" type="reset" />
            </p>
            <p>
                <label class="itemTitle">
                    状&nbsp;&nbsp;&nbsp;态：</label>
                <asp:DropDownList ID="StateDDL" runat="server" AutoPostBack="true" OnSelectedIndexChanged="StateDDL_OnSelectedIndexChanged">
                    <asp:ListItem Text="未申请" Value="0"></asp:ListItem>
                    <asp:ListItem Text="待审中" Value="1"></asp:ListItem>
                    <asp:ListItem Text="已审批[不通过]" Value="2"></asp:ListItem>
                    <asp:ListItem Text="已审批[通过]" Value="3"></asp:ListItem>
                </asp:DropDownList>
            </p>
        </div>
        <div class="main">
            <asp:GridView ID="BuyAppGridView" DataKeyNames="ID" CssClass="infoTable" runat="server"
                AllowPaging="true" OnRowDataBound="BuyAppGV_OnRowDataBound" PageSize="15" AutoGenerateColumns="false"
                OnPageIndexChanging="BuyAppGV_OnPageIndexChanging">
                <Columns>
                    <asp:TemplateField ItemStyle-CssClass="checkBox">
                        <HeaderTemplate>
                            <asp:CheckBox ID="CBAll" runat="server" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="chk" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="ClassNumber" HeaderText="分类号码" />
                    <asp:BoundField DataField="Name" HeaderText="仪器名称" />
                    <asp:BoundField DataField="Type" HeaderText="类型" />
                    <asp:BoundField DataField="Numbers" HeaderText="购买数量" />
                    <asp:BoundField DataField="AppPerson" HeaderText="申请人" />
                    <asp:BoundField DataField="AppTime" HeaderText="申请时间" DataFormatString="{0:yyyy-MM-dd}" />
                    <asp:BoundField DataField="State" HeaderText="状态" />
                    <asp:BoundField DataField="VerifyPerson" HeaderText="审核人" />
                    <asp:BoundField DataField="VerifyTime" HeaderText="审核时间" DataFormatString="{0:yyyy-MM-dd}" />
                </Columns>
                <EmptyDataTemplate>
                    暂无信息
                </EmptyDataTemplate>
                <HeaderStyle CssClass="header" />
            </asp:GridView>
        </div>
    </form>

    <script src="../../js/Common.js" type="text/javascript"></script>

    <script type="text/javascript" src="../../js/jQuery/jquery-1.3.1.js"></script>

    <script type="text/javascript" src="../../js/jQuery/jquery.bgiframe.js"></script>

    <script type="text/javascript" src="../../js/jQuery/jquery.json-1.3.min.js"></script>

    <script type="text/javascript" src="../../js/site.js"></script>

    <script type="text/javascript">
    
    /* 全选 */
            $("#BuyAppGridView > tbody > tr:first :checkbox").click(function(){
                if ($(this).attr("checked")){
                    $("#BuyAppGridView :checkbox").attr("checked", "checked");
                    cbChanged();
                } else{
                    $("#BuyAppGridView :checkbox").attr("checked", "");
                    cbChanged();
                }
            });
    /* Checkbox事件 */
            $("#BuyAppGridView :checkbox").not(":first").click(cbChanged);

            cbChanged();
    /* 检测Checkbox的选择状态，更改button的disabled属性 */
        function cbChanged(){
            var hasChecked = false;
            var allChecked = true;
            $("#BuyAppGridView :checkbox").not(":first").each(function(index, domEle){
                var curChecked = $(domEle).attr("checked");
                if (!hasChecked && curChecked){
                    hasChecked = true;
                }

                allChecked &= curChecked;
            });

            if (hasChecked){
                $("#DeleteBtn").attr("disabled", "");
            } else {
                $("#DeleteBtn").attr("disabled", "disabled");
            }

            if (allChecked){
                $("#BuyAppGridView :checkbox").filter(":first").attr("checked", "checked");
            } else {
                $("#BuyAppGridView :checkbox").filter(":first").attr("checked", "");
            }
        }
        
        //打开新窗口
         function openwin(url)
         {
             openNewWin(url,400,450);
         }
    </script>

</body>
</html>
